package cn.itcast.wanxinp2p.consumer.controller;

import cn.itcast.wanxinp2p.api.account.ConsumerApi;
import cn.itcast.wanxinp2p.common.DTO.comsumer.ConsumerRegisterDTO;
import cn.itcast.wanxinp2p.common.domain.RestResponse;
import cn.itcast.wanxinp2p.consumer.agent.DemoFeign;
import cn.itcast.wanxinp2p.consumer.service.ConsumerService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping
public class ConsumerController implements ConsumerApi {


    @Autowired
    private ConsumerService consumerService;


    @GetMapping
    public String test(){

        return "臭狗屎狗屎臭";

    }

    @ApiOperation("用户注册")
    @ApiImplicitParam(name = "consumerRegisterDTO", value = "用户注册", required =true,dataType = "AccountRegisterDTO", paramType = "body")
    @PostMapping(value = "/consumers")
    public RestResponse register(@RequestBody ConsumerRegisterDTO consumerRegisterDTO){
        //TODO 调用业务层实现用户注册
        consumerService.register(consumerRegisterDTO);

        return RestResponse.success();

    }

}
